﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using YAPL.Language.Ast.Utils;

namespace YAPL.Test.YAPL.Language.Ast.Utils {

	public class DefaultAstComparerTest {

		[Fact]
		public void SameTreesShouldBeEqual() {
			var comparer = new DefaultAstComparer<DefaultAstWalker>();

			var funcCallProgram = TestHelper.GetAstFromXML(FixturePath.FunctionCallNoParams_xml);
			Assert.True(comparer.Compare(funcCallProgram, funcCallProgram));

			var helloWorldProgram = TestHelper.GetAstFromXML(FixturePath.HelloWorld_xml);
			Assert.True(comparer.Compare(helloWorldProgram, helloWorldProgram));

			var variablesProgram = TestHelper.GetAstFromXML(FixturePath.AssignmentAndVariables_xml);
			Assert.True(comparer.Compare(variablesProgram, variablesProgram));
		}
	}
}
